package qsc.designpattern.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @auther QiuShangcheng
 * @create 2021/4/5
 */
public class DebugInvocationHandler implements InvocationHandler {
    private final Object target;

    public DebugInvocationHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("发送前----");
        Object result = method.invoke(target,args);
        System.out.println("发送后----");
        return result;
    }
}
